﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;
using  System.Data.SqlClient;
using System.Data;

namespace BUS
{
    public class PhieuThuBUS
    {
        #region 1. Them
        public static bool ThemPhieuThu(PhieuThuDTO phieuthu){
            if (!DocGiaDAO.CheckDocGiaByID(phieuthu.SoThe))
            {                
                return false;
            }
            return PhieuThuDAO.ThemPhieuThuTien(phieuthu);
        }
        #endregion
        #region 2. Sua
        public static bool SuaPhieuThu(PhieuThuDTO phieuthu){
            if (!DocGiaDAO.CheckDocGiaByID(phieuthu.SoThe))
            {
                return false;
            }
            return PhieuThuDAO.SuaPhieuThuTien(phieuthu);
        }
        #endregion
        #region 3. Xoa
        public static bool XoaPhieuThu(String mapt)
        {
            return PhieuThuDAO.XoaPhieuThuTien(mapt);
        }
        #endregion
        #region 4. Tim kiem
        public static PhieuThuDTO TimPhieuThuTien(String mapt){
            return PhieuThuDAO.TimPhieuThuTien(mapt);
        }
        public static List<PhieuThuDTO> TimTatCaPhieuThuTien(){
            return PhieuThuDAO.TimTatCaPhieuThu();
        }
        public static DataTable HienThiBang()
        {
            return PhieuThuDAO.ViewPhieuThu();
        }

        #endregion
    }
}
